package stu.aistar.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import stu.aistar.model.pojo.Ciname;

import java.util.List;

@Mapper
public interface CinameMapper {
    List<Ciname> findByArea(@Param("city") String city, @Param("area") String area);

    @Select("select *from ciname where id = #{id}")
    Ciname findById(@Param("id") Integer id);

    @Select({ "<script>",
            "SELECT address FROM ciname",
            "<if test='address != null and address != \"\"'>",
            "where address like '%${address}%'",
            "</if>",
            "</script>"})
    List<String> findAllAddress(@Param("address") String address);

    @Select("select *from ciname where address = #{address}")
    Ciname findByAddress(String address);
}
